package operation;

import book.BookList;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: a1227
 * Date: 2022-10-04
 * Time: 12:00
 */
public class FindOperation implements IOperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("查询书籍！");
        System.out.println("请输入所要查阅的书名:>");
        String name = scanner.nextLine();
        int i = 0;
        for(; i < bookList.getSize(); i++){
            if(name.equals(bookList.getBook(i).getName())){
                System.out.println("所要查阅的书籍信息如下:");
                System.out.println(bookList.getBook(i));
                return ;
            }
        }
        System.out.println("所要查阅的书籍不存在！");
    }
}
